package com.itlong.cloud.sdk.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyAddVisitorDTO;
import com.itlong.cloud.POJO.DTO.property.PropertyGetVisitorInfoDTO;
import com.itlong.cloud.POJO.VO.sdk.SDKFaceVisitorInfoVO;
import com.itlong.cloud.sdk.service.IFaceSDKVisitorPassCodeRecordService;
import com.itlong.cloud.user.sdk.IFaceSDKVisitorServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <desc>
 *      人脸识别API-访客业务处理暴露接口实现类
 * </desc>
 *
 * @createDate 2019/11/11
 */
@RestController
public class FaceSDKVisitorServiceResource implements IFaceSDKVisitorServiceClient {
    @Autowired
    IFaceSDKVisitorPassCodeRecordService iFaceSDKVisitorPassCodeRecordService;

    /**
     * <desc>
     *     访客列表
     * <desc/>
     *
     * @param  visitorInfoDTO  分页查询访客列表
     * @return  MessageVO 标准格式化响应结果
     * @author JuGuang.S
     * @createDate 2019/11/11
     */
    @Override
    @PostMapping(path = "/sdk/face/getVisitorInfoByPage")
    public Page<SDKFaceVisitorInfoVO> getVisitorInfoForFaceApi(@RequestBody PropertyGetVisitorInfoDTO visitorInfoDTO) throws Exception {
        return iFaceSDKVisitorPassCodeRecordService.getVisitorInfoForFaceApi(visitorInfoDTO);
    }

    /**
     * <desc>
     *     校验地址是否真实存在
     * <desc/>
     *
     * @param  visitorInfoDTO  校验条件
     * @return 楼栋单元房间编号ID
     * @author JuGuang.S
     * @createDate 2019/11/18
     */
    @Override
    @PostMapping(path = "/sdk/face/getAddressInfo")
    public Map<String,Object> getAddressInfo(@RequestBody PropertyAddVisitorDTO visitorInfoDTO) throws Exception{
        return iFaceSDKVisitorPassCodeRecordService.getAddressInfo(visitorInfoDTO);
    }

}
